import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/24 10:18
 */

public class Solution {
    public int lengthOfLongestSubstring(String s){
        char[] ch = s.toCharArray();
        int[] hash = new int[128];
        int left = 0,right = 0,n = s.length(),res = 0;
        while(right < n){
            hash[ch[right]]++;
            while(hash[ch[right]] > 1){
                hash[ch[left++]]--;
            }
            res = Math.max(res,right - left + 1);
            right++;
        }
        return res;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String s = in.nextLine();
            Solution solution = new Solution();
            System.out.println(solution.lengthOfLongestSubstring(s));
        }
    }
}